function res = regressDShortRate(data,sampletime_Per_Maturitytime,regime_2)

% Standard regression
dShort  = data(sampletime_Per_Maturitytime+1:end,1)-data(1:end-sampletime_Per_Maturitytime,1);
slope   = data(1:end-sampletime_Per_Maturitytime,end)-data(1:end-sampletime_Per_Maturitytime,1);
level   = mean(data(1:end-sampletime_Per_Maturitytime,:),2);
X       = [ones(length(slope),1) slope level];
ols     = nwest(dShort,X,3);

% Regression with regime-switching
X         = [ones(length(slope),1) slope level ...
            regime_2(1:end-sampletime_Per_Maturitytime) regime_2(1:end-sampletime_Per_Maturitytime).*slope ...
                                                        regime_2(1:end-sampletime_Per_Maturitytime).*level];
olsRS = nwest(dShort,X,3);

% The results
res.ols   = ols;
res.olsRS = olsRS;